This repository was archived by the owner on Sep 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 218
Embedded structs v3 #100
Merged
aren55555
merged 15 commits into
google:feature/embeded-structs
from
skimata:embedded-structs-v3
Jul 27, 2017
Merged
Embedded structs v3 #100
aren55555
merged 15 commits into
google:feature/embeded-structs
from
skimata:embedded-structs-v3
Jul 27, 2017
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…top-level to embedded
Closed
…aler/Unmarshaler" This reverts commit deeffb7.
Open
shwoodard
reviewed
Nov 10, 2017
}) | ||
} | ||
for _, scenario := range scenarios { | ||
t.Logf("running scenario: %s\n", scenario.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skimata please submit pr to use t.Run
marc-lebourdais
pushed a commit
to marc-lebourdais/jsonapi
that referenced
this pull request
Mar 10, 2018
* working version * fix text * combine test files * move private funcs to bottom * ErrInvalidType should ignore interfaces * replace MarshalOnePayload w/ MarshalPayload; fix bug w/ node merge() * minor tweaks; address a couple comments * decompose unmarshalNode() to smaller funcs; unmarshal should go from top-level to embedded * deep copy the node when passing relation/sideloaded notes to unmarshal() * add some comments and do some additional cleanup * add test uses annotationIgnore * implement support for struct fields that implement json.Marshaler/Unmarshaler * add additional test that compares marshal/unmarshal behavior w/ standard json library * add support for pointer embedded structs * Revert "implement support for struct fields that implement json.Marshaler/Unmarshaler" This reverts commit deeffb7.
Is there a reason, that this MR got merged into |
it looks like this will never be supported huh ? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is an update to #78. I found it cleaner and more convenient to just cherry-pick my changes in the latest google/jsonapi.
All comments made to the last PR should be addressed here. Addressing the last comment in that PR required some refactor/enhancements, hence took some time.
I added these additional examples:
The expected behavior is that it will behave in the "expected" composition behavior; it will handle the top-level struct fields first, then handle any embedded structs after that. So in the scenario where there is a top-level struct that has a primary annotation, that embeds another struct also containing a primary annotation, the top-level attribute wins. (In the below example, the expected jsonapi payload should have a data/resource type of "posts")
Lastly, I felt it was getting complex and a bit messy, so I started splitting out
unmarshalNode()
into smaller functions for better readability.Happy to add something to the readme.md if you think that would be useful